package hbt;

import negocio.*;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

import controlador.Restaurant;

public class HibernateUtil {

	private static final SessionFactory session;
	static{
		try{
			
			AnnotationConfiguration config = new AnnotationConfiguration();
			config.addAnnotatedClass(Restaurant.class);
			config.addAnnotatedClass(Administracion.class);			
			config.addAnnotatedClass(Area.class);
			config.addAnnotatedClass(Caja.class);
			config.addAnnotatedClass(Cajero.class);
			config.addAnnotatedClass(Carta.class);				
			config.addAnnotatedClass(Comanda.class);
			config.addAnnotatedClass(Comision.class);
			config.addAnnotatedClass(Deposito.class);
			config.addAnnotatedClass(DepositoLocal.class);
			config.addAnnotatedClass(DepositoCentral.class);
			config.addAnnotatedClass(Empleado.class);
			config.addAnnotatedClass(Factura.class);
			config.addAnnotatedClass(IngredienteSimple.class);
			config.addAnnotatedClass(Insumo.class);
			config.addAnnotatedClass(ItemComanda.class);	
			config.addAnnotatedClass(ItemFactura.class);			
			config.addAnnotatedClass(ItemReceta.class);
			config.addAnnotatedClass(Mesa.class);
			config.addAnnotatedClass(MesaCompuesta.class);	
			config.addAnnotatedClass(MesaSimple.class);	
			config.addAnnotatedClass(MovimientoDeProductos.class);	
			config.addAnnotatedClass(Mozo.class);	
			config.addAnnotatedClass(NotaDevolucion.class);
			config.addAnnotatedClass(OrdenDeCompra.class);
			config.addAnnotatedClass(PlanDeProduccion.class);
			config.addAnnotatedClass(Plato.class);
			config.addAnnotatedClass(Producto.class);
			config.addAnnotatedClass(Proveedor.class);
			config.addAnnotatedClass(Receta.class);
			config.addAnnotatedClass(Remito.class);
			config.addAnnotatedClass(RubroCarta.class);
			config.addAnnotatedClass(Salon.class);
			config.addAnnotatedClass(Sector.class);
			config.addAnnotatedClass(Tarea.class);
			config.addAnnotatedClass(XML.class);
			session = config.buildSessionFactory();
		}
		catch (Throwable ex)
	    {
	         System.err.println("Initial SessionFactory creation failed." + ex);
	         throw new ExceptionInInitializerError(ex);
	    }
	}
	
	
	public static SessionFactory getSessionFactory()
	{
		return session;
	}
}
